//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    winWidth: 0,
    winHeight: 0,
    // tab切换  
    currentTab: 0,
    balance: '14118.80',
    shujuils: [{
        name: '招商奖',
        rmb: '98000.63',
        time: '2019-03-09 16:38'
      },
      {
        name: '招商奖',
        rmb: '98000.63',
        time: '2019-03-09 16:38'
      }
    ]
  },
  onLoad: function() {
    this.setData({
      userId: wx.getStorageSync('userId'),
    })
    var that = this;

    /** 
     * 获取系统信息 
     */
    wx.getSystemInfo({
      success: function(res) {
        that.setData({
          winWidth: res.windowWidth,
          winHeight: res.windowHeight
        });
      }
    });
    this.mingxi();
  },
  mingxi: function () {//账户余额
    var that = this;
    wx.request({
      url: app.globalData.apiUrl + 'Finance/wList',
      data: {
        // opt: 'getUser',
        userId: that.data.userId,
      },
      header: {
        'content-type': 'application/json'
      },
      success: function (res) {
        console.log(res, '用户信息')
        if (res.data != null) {
          that.setData({
            info: res.data,
          })

        }
      }

    })
    console.log(that.data.canIUse)
  },
  /** 
   * 滑动切换tab 
   */
  bindChange: function(e) {
    var that = this;
    that.setData({
      currentTab: e.detail.current
    });
  },
  /** 
   * 点击tab切换 
   */
  swichNav: function(e) {
    var that = this;
    if (this.data.currentTab === e.target.dataset.current) {
      return false;
    } else {
      that.setData({
        currentTab: e.target.dataset.current
      })
    }
  },
  zhanghu:function(){
    wx.navigateTo({
      url: '../zhanghu',
    })
  }

})